home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / System 7.0 Samples / INIT - CDEV / INIT.a < prev    next >
Encoding:
Text File  |  1990-11-24  |  2.2 KB  |  77 lines  |  [TEXT/MPS ]

  1. *------------------------------------------------------------------------------
  2. *
  3. *    Apple Macintosh Developer Technical Support
  4. *
  5. *    Sample Control Panel Device and INIT Combination
  6. *
  7. *    Program:    INIT - CDEV
  8. *    File:        INIT.a    -    Asm Source
  9. *
  10. *    Copyright © 1990 Apple Computer, Inc.
  11. *    All rights reserved.
  12. *
  13. *------------------------------------------------------------------------------
  14.  
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. ;
  17. ;    void a_SystemTask()
  18. ;
  19. ;    This is the real patch to SystemTask(). It saves all registers that
  20. ;    shouldn't be tampered with, calls the C routine that does all the dirty
  21. ;    work, and restores the registers. It then pushes the address of the
  22. ;    real ROM SystemTask routine onto the stack and RTS, which is a neat
  23. ;    way to jump to that routine without messing up any registers.
  24. ;
  25. ;    "oldSystemTask" is filled in during INIT initialization by the routine
  26. ;    INITInstall.
  27. ;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29.  
  30. a_SystemTask    PROC    EXPORT
  31.                 IMPORT    c_SystemTask:CODE
  32.                 EXPORT    oldSystemTask
  33.                 
  34.                 movem.l    D0-D7/A0-A5,-(sp)        ; Save our registers
  35.                 bsr        c_SystemTask            ; call the C routine
  36.                 movem.l    (sp)+,D0-D7/A0-A5        ; restore the registers
  37.                 move.l    oldSystemTask,-(sp)        ; push addr. of orig. SystemTask
  38.                 rts                                ; RTS will just jump to it.
  39.  
  40. oldSystemTask    ds.l    1                        ; address of original SystemTask
  41.  
  42.                 ENDP
  43.  
  44.  
  45. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  46. ;
  47. ;    void a_SetA5Ref(A5Ref)
  48. ;
  49. ;        Simply takes the value passed in and saves it in "A5Storage". This
  50. ;        routine uses the C calling convetion, so it doesn't need to pull
  51. ;        and parameters off of the stack.
  52. ;
  53. ;    long a_GetA5Ref()
  54. ;
  55. ;        Returns the value stored in "A5Storage". This routine uses the C
  56. ;        callin convention, so the result is returned in D0.
  57. ;
  58. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  59.  
  60. a_SetA5Ref        PROC    EXPORT
  61.                 EXPORT    a_GetA5Ref
  62.  
  63.                 lea        A5Storage,A0            ; get address of storage
  64.                 move.l    4(sp),(A0)                ; move value to save into it
  65.                 rts                                ; return to caller
  66.  
  67. a_GetA5Ref
  68.                 move.l    A5Storage,D0            ; get result into D0
  69.                 rts                                ; return to caller
  70.  
  71. A5Storage        ds.l    1                        ; storage for A5 reference
  72.  
  73.                 ENDP
  74.  
  75.                 END
  76.  
  77.